package com.example.myredis.auto;

import com.example.myredis.config.MyRedisConfig;
import com.example.myredis.service.MyRedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(MyRedisConfig.class)
public class MyRedisAutoConfiguration {

    @Autowired
    MyRedisConfig myRedisConfig;

    @Bean
    public MyRedisService myRedisService() {
        System.out.println("redis url: " + myRedisConfig.getUrl());
        return new MyRedisService();
    }

}
